import { createSlice } from "@reduxjs/toolkit";

const infoMoudle = createSlice({
    name: 'info',
    initialState: { //初始化状态
        user: '',
        roles: ''
    },
    reducers: {     //修改状态
        setInfo(state, action) {
            state.user = action.payload.user;
            state.roles = action.payload.roles;
        }
    }

})
// 解构修改方法
const { setInfo } = infoMoudle.actions;

//获取reducer
const reducer = infoMoudle.reducer;

export { setInfo }
export default reducer